<?php

/**
 * This is the model class for table "member".
 *
 * The followings are the available columns in table 'member':
 * @property string $me_id
 * @property string $me_account
 * @property string $me_password
 * @property string $me_nickname
 * @property string $me_sex
 * @property string $me_photo
 * @property integer $me_level
 * @property string $me_login
 * @property string $me_device
 * @property string $me_email
 * @property string $me_ip
 * @property integer $me_createtime
 * @property integer $me_updatetime
 * @property string $me_phone
 */
class Member extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Member the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'member';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('me_account, me_password, me_nickname, me_sex, me_photo, me_login, me_device, me_email, me_ip, me_createtime, me_updatetime, me_phone', 'required'),
			array('me_level, me_createtime, me_updatetime', 'numerical', 'integerOnly'=>true),
			array('me_account, me_nickname, me_photo, me_email', 'length', 'max'=>255),
			array('me_password', 'length', 'max'=>50),
			array('me_sex, me_login', 'length', 'max'=>1),
			array('me_ip, me_phone', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('me_id, me_account, me_password, me_nickname, me_sex, me_photo, me_level, me_login, me_device, me_email, me_ip, me_createtime, me_updatetime, me_phone', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'me_id' => 'Me',
			'me_account' => 'Me Account',
			'me_password' => 'Me Password',
			'me_nickname' => 'Me Nickname',
			'me_sex' => 'Me Sex',
			'me_photo' => 'Me Photo',
			'me_level' => 'Me Level',
			'me_login' => 'Me Login',
			'me_device' => 'Me Device',
			'me_email' => 'Me Email',
			'me_ip' => 'Me Ip',
			'me_createtime' => 'Me Createtime',
			'me_updatetime' => 'Me Updatetime',
			'me_phone' => 'Me Phone',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('me_id',$this->me_id,true);
		$criteria->compare('me_account',$this->me_account,true);
		$criteria->compare('me_password',$this->me_password,true);
		$criteria->compare('me_nickname',$this->me_nickname,true);
		$criteria->compare('me_sex',$this->me_sex,true);
		$criteria->compare('me_photo',$this->me_photo,true);
		$criteria->compare('me_level',$this->me_level);
		$criteria->compare('me_login',$this->me_login,true);
		$criteria->compare('me_device',$this->me_device,true);
		$criteria->compare('me_email',$this->me_email,true);
		$criteria->compare('me_ip',$this->me_ip,true);
		$criteria->compare('me_createtime',$this->me_createtime);
		$criteria->compare('me_updatetime',$this->me_updatetime);
		$criteria->compare('me_phone',$this->me_phone,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}